package com.adinnet.api.school.service.impl;

import com.adinnet.api.school.model.School;
import com.adinnet.api.school.mapper.SchoolMapper;
import com.adinnet.api.school.service.SchoolService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 校区 服务实现类
 * </p>
 *
 * @author liukp
 * @since 2020-12-02
 */
@Service
public class SchoolServiceImpl extends ServiceImpl<SchoolMapper, School> implements SchoolService {

    @Autowired
    private SchoolMapper schoolMapper;

    /**
     * 校区列表
     *
     * @param limit
     * @param page
     * @return
     */
    @Override
    public IPage<School> schoolList(Integer limit, Integer page) {
        return schoolMapper.selectPage(new Page<>(page, limit), new QueryWrapper<School>().eq("deleted", 0).orderByDesc("updated_date"));
    }
}
